<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
	</head>
	
	<script type="text/javascript">
		//定义对象并初始化
		var person = {
			firstName:"陈", 				//定义属性
			lastName:"子枢", 
			age: 18,
			fullName1 : function(){		//定义方法
				return this.firstName + " " + this.lastName;
			}
		};
		console.log(person);
		
		//又添加属性，多么灵活
		person.address = "北京";	
		console.log(person);
		
		//添加方法
		person.fullName2 = function(){
			return this.firstName + " " + this.lastName;
		}
		console.log(person);
		console.log(person.fullName2());
		console.log(person.fullName1());
		
		//重复声明不会报错，而直接把前面的都干掉
		var person = {name:"陈子枢"};
		console.log(person);
		console.log(person.age);
	</script>
</html>
